package com.briup.ch06.test;

public class Cylinder extends Circle{
    private double height;
    public Cylinder(double radius,double height)
    {
        super(radius);
        this.height=height;
    }
    @Override
    public double surfaceArea()
    {
        double r=getRadius();
        return 2*Math.PI*r*r+2*Math.PI*r*this.height;
    }
    @Override
    public String toString()
    {
        return "圆柱的表面积为："+this.surfaceArea()+" "+"圆柱的体积为："+this.vulome();
    }
    public double vulome()
    {
        double r=getRadius();
        return Math.PI*r*r*this.height;
    }
}
